home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / debug / rem_getf.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  4KB  |  122 lines

  1. /*
  2.  *  CopyRight 1995. Nicholas Poljakov all rights reserved.
  3.  */
  4. /*************************  REM_GETF.C  ***************************/
  5. /*                 get file name for remote LU                    */
  6. /******************************************************************/
  7.  
  8. #include <dos.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <io.h>
  12. #include <fcntl.h>
  13. #include <stdlib.h>
  14. #include <state1.h>
  15. extern int sw;
  16. extern char lu_id[8];
  17. extern char tp_id[8];
  18. extern char tp_exist;
  19. extern  unsigned  long conv_id;
  20. extern struct  part {            /* partner structure */
  21.           char     plu[8] ;         /* str plu_name        */
  22.                   int psl;                    /* str plu_s_limit     */
  23.           char     mode_name[8] ;         /* str mode_name        */
  24.                   int max_ru_size;            /* str ru_h_size       */
  25.                   int pacing;                 /* str =               */
  26.                   unsigned char lu_type;
  27.                }  pstr[4];
  28.  
  29. rem_getf(s_dta,from)
  30.    int from;
  31.    struct dt {
  32.          char reserv[21];
  33.          char attr;
  34.          unsigned int time;
  35.          unsigned int date;
  36.          unsigned long int size;
  37.          char name[18];
  38.        }  *s_dta;
  39. {
  40.     unsigned char rts;
  41.     unsigned char wr;
  42.     unsigned int max_length ;
  43.     unsigned  char tpn[64];
  44.     struct rc {
  45.                 unsigned int prim;
  46.                 unsigned long sec;
  47.               } v_rc;
  48.     struct msg {  /*send_data*/
  49.                 int len;
  50.                 char str[sizeof(struct dt)];
  51.                } gds;
  52.     unsigned long rc;
  53.     char p_lu[9];
  54.     char p_mode[9];
  55.     int length;
  56.  
  57.               if (sw == 0) {
  58.                    if (!tp_exist) {
  59.                         tp_started
  60.                                    (lu_id,
  61.                                     tp_id,
  62.                                     &rc);
  63.                         if (rc != 0) {
  64.                             return -1;
  65.                         }
  66.                         tp_exist = 1; /* TP_started O.K! */
  67.                    }
  68.  
  69.                    strcpy (tpn,"DIR "); /* name of work */
  70.                    strcat (tpn, "get");      /* name of sub-funct */
  71.                    /*conv_id - return param -id work link */
  72.            strcpy(p_lu, pstr[from - 1].plu);
  73.            strcpy(p_mode, pstr[from - 1].mode_name);
  74.                    allocate  (p_lu,
  75.                               p_mode,
  76.                               tpn,
  77.                               WHEN_SESSION_ALLOCATED,
  78.                               NONE,
  79.                               NONE,
  80.                               NULL,
  81.                               NULL,
  82.                               tp_id,
  83.                               &conv_id,
  84.                               NULL,
  85.                               &v_rc) ;
  86.  
  87.  
  88.                   if (v_rc.prim != 0) {
  89.                                           return (-1);
  90.                                        }
  91.                   sw++;
  92.               }  /* sw == 0 */
  93.               max_length = 2017;
  94.               recwait (tp_id,
  95.                     conv_id,
  96.                     ll,
  97.                     &v_rc,
  98.                     &length,
  99.                     max_length,
  100.                     &rts,
  101.                     &gds,
  102.                     &wr);
  103.               if (v_rc.prim != 0) {
  104.                     return -1;
  105.               }
  106.               memcpy (s_dta,gds.str,sizeof(struct dt));
  107.  
  108.               recwait (tp_id,
  109.                     conv_id,
  110.                     ll,
  111.                     &v_rc,
  112.                     &length,
  113.                     max_length,
  114.                     &rts,
  115.                     &gds,
  116.                     &wr);
  117.               if (v_rc.prim != 0) {
  118.                     return -1;
  119.               }
  120.               return 0;
  121. }
  122.